| Word | Description |
|---|---|
| 保存場所 | スクリプトはAfter Effectsのインストールフォルダ内にある'Scripts'フォルダに保存されます。(C:\Program Files\Adobe\Adobe After Effects 2023\Support Files\Scripts\ScriptUI Panels)さらに、UIパネルとして動作させるためのスクリプトは'Scripts/ScriptUI Panels'サブフォルダに保存されます。 |
| 表示場所 | スクリプトUIパネルは、After Effectsのメニューバーから「ウィンドウ」メニューを開いて、スクリプトの名前を選択することで表示されます。一番下にあります。また、プログラムを実行し開かれたUIパネルは任意の場所にドッキングしたり、フローティングウィンドウとして表示したりできます。 |
// myScriptという関数を定義します。この関数はUIパネルを生成し、表示します。
function myScript(thisObj) {
// myScript_buildUIという内部関数を定義します。この関数はUIパネルを生成します。
function myScript_buildUI(thisObj) {
// myPanelを定義します。もしthisObjがPanelオブジェクトならそのまま使い、そうでなければ新たにWindowを作成します。
var myPanel = (thisObj instanceof Panel) ? thisObj : new Window('palette', 'My Script', undefined, {resizeable:true});
// リソース文字列を定義します。これはUIパネルのレイアウトと要素を定義します。
res = 'group{orientation:\'column\', alignChildren:[\'fill\', \'top\'],\
textInput: EditText{text:\'Your text here\', characters:30},\
createButton: Button{text:\'Create Text Layer\'},\
}'
// 定義したリソース文字列をパネルに追加します。
myPanel.grp = myPanel.add(res);
// パネルのサイジングを設定し、パネルをリサイズ可能にします。
myPanel.layout.layout(true);
myPanel.grp.minimumSize = myPanel.grp.size;
myPanel.layout.resize();
myPanel.onResizing = myPanel.onResize = function () {this.layout.resize();}
// パネルオブジェクトを返します。
return myPanel;
}
// myScript_buildUI関数を呼び出し、結果をmyScriptPalに格納します。
var myScriptPal = myScript_buildUI(thisObj);
// myScriptPalがWindowオブジェクトなら、それを中心に表示します。
if ((myScriptPal != null) && (myScriptPal instanceof Window)) {
myScriptPal.center();
myScriptPal.show();
} else {
myScriptPal.layout.layout(true);
}
}
// スクリプトの最初のエントリーポイント。myScript関数を呼び出します。
myScript(this);
Creation Date: 2023-07-31
Creator: hoehoe
Source: GPT4